/**
 * 描述：基于二分搜索树实现的一个Set
 *
 * @author 王博
 * @version 1.0
 * create 2018-10-23-17:49
 */
public class BSTSet<E extends Comparable<E> > implements Set<E>{

    private BST<E> bst;

    public BSTSet(){
        bst = new BST<> ();
    }

    @Override
    public boolean isEmpty(){
        return bst.isEmpty ();
    }

    @Override
    public boolean contains(E e) {

        return bst.contains (e);

    }

    @Override
    public int getSize( ) {
        return bst.getSize ();
    }

    @Override
    public void add(E e) {
     bst.add (e);
    }

    @Override
    public void remove(E e) {
        bst.remove (e);
    }

    public static void main(String[] args){
        BSTSet<Integer> bstSet = new BSTSet <> ();
        bstSet.add (20);
        bstSet.add (20);
        bstSet.add (20);
        System.out.println (bstSet.getSize ());
    }
}
